<div id="api-doc" class="mock-body" *ngIf="api && doc">
    <div class="api-doc-item position-relative">
        <h2>Mock列表</h2>
        <div class="position-right">
            <a class="api-call-link mr-1" [routerLink]="['/doc', doc.artifact.id, api.key]">接口文档</a>
            <a class="api-call-link mr-1" [routerLink]="['/doc', doc.artifact.id, api.key, 'mock', 'new']">添加Mock</a>
        </div>
        <div class="alert alert-info mt-2 mb-1">
            同时命中多个mock条件时，会取命中的第一个！
        </div>
        <div class="tab" id="invoke-tab">
            <div id="table-content">
                <table class="table">
                    <tr>
                        <th>序号</th>
                        <th>标题</th>
                        <th>类型</th>
                        <th>条件</th>
                        <th>操作</th>
                    </tr>
                    <ng-container *ngFor="let mock of mocks; let index = index">
                        <tr>
                            <td rowspan="2">{{index + 1}}</td>
                            <td>{{mock.title?mock.title:'--'}}</td>
                            <td>{{mock.responseType===0 ? 'mock配置' : 'json'}}</td>
                            <td><pre>{{getMockCondStr(mock)}}</pre></td>
                            <td>
                                <a [routerLink]="['/doc', doc.artifact.id, api.key, 'mock', mock.id]" class="mr-1">编辑</a>
                                <a href="javascript:" (click)="delete(index)">删除</a>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4">
                                <a href="{{getMockUrl(mock)}}" target="_blank">curl -X GET '{{getMockUrl(mock)}}'</a>
                            </td>
                        </tr>
                    </ng-container>
                    <tr>
                        <td colspan="5" class="align-right">
                            <a class="opt" [routerLink]="['/doc', doc.artifact.id, api.key, 'mock', 'new']">
                                <i class="icon material-icons">add</i>添加Mock
                            </a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</div>
